//  -------------------- iSharePoint -------------------- //
// 
//  Company:	IT Complex, LLC
//  Project:	Smart.Common
//  File name:	WebSecurityConceptRoleBased.cs
//  Developer:	Solomatov Igor
//  Created:	15.04.2012
// 
//  -------------------- iSharePoint -------------------- //

namespace Smart.Common.Security
{
	/// <summary>
	/// SharePoint Role-based Security Concept (Users, Groups, Roles, Permission Levels) matrix-based
	/// </summary>
	public class WebSecurityConceptRoleBased : WebSecurityConcept
	{
		/// <summary>
		/// SharePoint Role-based Security Concept (Users, Groups, Roles, Permission Levels)
		/// </summary>
		public WebSecurityConceptRoleBased(SecurityContext ctx)
			: base(ctx)
		{
		}

		/// <summary>
		/// Return security principal by <paramref name="sourcePrincipal"/>
		/// </summary>
		public override string GetSecurityPrincipal(string sourcePrincipal)
		{
			var newPrincipal = Ctx.Values.SafeGetStr(sourcePrincipal, null);

			return
				newPrincipal ?? base.GetSecurityPrincipal(sourcePrincipal);
		}
	}
}